package com.eugene.ui.viewerfilter;

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

import com.eugene.element.FnCalendar;
import com.eugene.entity.CommonEntity;

public class MarketVariableIdFilter extends ViewerFilter {
	private String searchString;
	private String searchDate;

	public void setSearchText(String s) {
		// Search must be a substring of the existing value
		this.searchString = ".*" + s + ".*";
	}
	public void setSearchDate(FnCalendar s) {
		// Search must be a substring of the existing value
		this.searchDate = ".*" + s.toString() + ".*";
	}
	public void setSearchDate(String s) {
		// Search must be a substring of the existing value
		this.searchDate = ".*" + s + ".*";
	}
	@Override
	public boolean select(Viewer viewer, Object parentElement, Object element) {
		CommonEntity irCurve = (CommonEntity) element;
		if (searchString == null || searchString.length() == 0) {
			return true;
		}
		if (irCurve.getEtyId().matches(searchString)) {
			return true;
		}
		

		return false;

	}

}
